//
//  ViewController.m
//  UIAppearenceTest
//
//  Created by wangrui on 13-12-31.
//  Copyright (c) 2013年 PPS. All rights reserved.
//

#import "ViewController.h"
#import "Test.h"
#import "CTAppearance+UIKit.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    
//    id a = [UINavigationBar appearance];
//    Test *tt = [[Test alloc]initWithFrame:CGRectMake(0, 20, 320, 44)];
//    //tt.barTintColor = [UIColor yellowColor];
//    
//    [self.view addSubview:tt];
//    [a setBarTintColor:[UIColor yellowColor]];
//    NSLog(@"%@",tt.barTintColor);
    
    
    self.title = @"Navigation";
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:Nil action:Nil];
    self.navigationItem.titleView = [UIButton buttonWithType:UIButtonTypeContactAdd];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:
                                              [UIButton buttonWithType:UIButtonTypeInfoDark]];
    
    //[self.navigationController.navigationBar setBarTintColor:[UIColor yellowColor]];//这句话有效果
    
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 50, 320, 50)];
    view.backgroundColor = [UIColor redColor];
    [self.view addSubview:view];
    
    [[UIView appearance] setBackgroundColor:[UIColor yellowColor]];
    
}


- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    
    //[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
}


- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
  
    //[[UINavigationBar appearanceWhenContainedIn:[UINavigationController class],nil] setBarTintColor:[UIColor redColor]];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
